//获取iframe的document对象
var iframeBox = document.getElementsByClassName('wgiframe')[0];
//等待iframe加载完成
iframeBox.onload = function () {
    if (iframeBox) {
        const iframeDocument = iframeBox.contentDocument || iframeBox.contentWindow.document;
        const style = iframeDocument.createElement('style');
        style.textContent = `
 #main-tab-item1-tree {
    width: 18% !important;
}

.houder-view-tree.jstree.jstree-1.jstree-default.jstree-checkbox-selection.jstree-leaf {
    width: 18% !important;
}

.houder-view-main {
    left: 18% !important;
}

a.jstree-anchor {
    max-width: 75%;
    word-wrap: break-word;
    word-break: break-all;
    white-space: break-spaces;
    height: auto !important;
}

li.jstree-node.jstree-open {
    word-wrap: break-word;
    word-break: break-all;
    white-space: break-spaces;
}

.houder-view-main-center-main-group-content table {
    width: 100% !important;
}

tr>td:only-child .houder-view-main-center-main-image-container {
    width: 100% !important;
    height: 850px !important;
}

.houder-view-main-center-main-image-container {
    width: 100% !important;
}

.houder-view-tree {
    overflow: unset !important;
}
`
        iframeDocument.head.appendChild(style);
    }
}
document.getElementsByClassName('body-area')[0].style.width = '100%'








// //获取1234按钮组
// // const buttonGroup = iframeDocument.getElementsByClassName('houder-view-main');
// // console.log(buttonGroup[0]);
// //获取图片容器
// const iframeBody = iframeDocument.querySelector('body');
// console.log(iframeBody);
// const imageContainer = iframeBody.getElementsByClassName('houder-view-main-center-main-image-container');
// console.log(imageContainer);
// //查找具有指定data-layout-value属性的按钮           
// const targetButton = iframeBody.querySelectorAll('.houder-view-main-center-button[data-layout-value="4"]');
// console.log(targetButton);
// const test = iframeBody.getElementsByClassName('houder-view-main-center-button')
// console.log(test);
// console.log(test.length);
// for (let i = 0; i < test.length; i++) {
//     if (test[i].getAttribute('data-layout-value') === '4') {
//         console.log('找到了', test[i]);
//     }
// }


// //添加高度的函数
// function checkButtonState() {
//     console.log('我来了');
//     //检查按钮是否存在特定类名
//     if (targetButton && !targetButton.classList.contains('houder-view-main-topbar-layout-button-selected')) {
//         console.log('000');
//         for (let i = 0; i < imageContainer.length; i++) {
//             imageContainer[i].style.height = '212px ';
//         }
//     } else {
//         console.log('111', imageContainer.length, imageContainer);
//         for (let i = 0; i < imageContainer.length; i++) {
//             console.log(imageContainer[i].style.height);
//             imageContainer[i].style.height = '408px';
//         }
//     }


// checkButtonState();



// //监听按钮状态变化
// const config = { attributes: true };
// const callback = function (mutationsList, observer) {
//     console.log('mutationsList', mutationsList);
//     for (const mutation of mutationsList) {
//         if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
//             const addedClass = mutation.target.classList;
//             //检查按钮是否存在特定类名
//             if (addedClass.contains('houder-view-main-topbar-layout-button-selected')) {
//                 imageContainer.style.height = '408px !important';

//             } else {
//                 imageContainer.style.height = '212px !important';
//             }
//         }
//     }
// }
// //创建一个观察器实例并传入回调函数
// const observer = new MutationObserver(callback);
// //开始监听目标节点
// observer.observe(targetButton, config);
//     };